package com.aaa.fees.controller.api;


import com.aaa.entity.CareHistory;
import com.aaa.fees.service.PayChargeService;
import com.aaa.fees.vo.PostObjVo;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("fees/api/pay")
public class ApiPaychargeController {
    @Autowired
    private PayChargeService payChargeService;
   // 挂号单 查  具体信息  和 支付页面
     @GetMapping("/getId/{regId}")
    public Result<Map<String, Object>> getPayCharge(@PathVariable String regId){
        return payChargeService.queryByIdHistory(regId);
    }
    //微信支付
    @PostMapping("/handlePayWithZfb")
    public Result handlePayWithZfb(@RequestBody PostObjVo postObjVo){
//        System.out.println("++++++++++++++++++++++++++++++++++++++++");
//        System.out.println("postObjVo = " + postObjVo);
       return payChargeService.handlePayWithZfb(postObjVo);
    }
    //微信支付 根据订单号 查询状态  order_id
    @PostMapping("/queryOrderChargeOrderId/{orderId}")
    public Result queryOrderChargeOrderId(@PathVariable String orderId){
        return payChargeService.queryOrderChargeOrderId(orderId);
    }

    //现金支付
    @PostMapping("createOrderChargeWithCash")
    public Result createOrderChargeWithCash(@RequestBody PostObjVo postObjVo){
         return payChargeService.createOrderChargeWithCash(postObjVo);
    }
}
